<template>
  <el-config-provider :locale="zhCn">
    <router-view />
  </el-config-provider>
</template>
<script setup>
  import zhCn from "element-plus/es/locale/lang/zh-cn";
  import { setCssCdn, setJsCdn } from "tools-utils/resource";
  import { useTitle } from "@/utils/tools";

  // 当前路由实例
  const route = useRoute();

  // 配置信息 store
  const configStore = useConfigStore();

  // 设置初始化，防止刷新时恢复默认
  onBeforeMount(() => {
    // 设置批量第三方 icon 图标
    setCssCdn(configStore.config.iconfontUrl);
    // 设置批量第三方 js
    setJsCdn(configStore.config.jsCdnUrl);
  });

  // 监听路由的变化，设置网站标题
  watch(() => route.path, useTitle, { deep: true });
</script>
